package cn.bonoon.kernel.descriptors.impl;

import java.lang.reflect.Field;
import java.util.List;
import java.util.Set;

import javax.persistence.Embeddable;

import cn.bonoon.kernel.descriptors.EmbeddedPropertyAccessor;
import cn.bonoon.kernel.support.entities.EntityTree;
import cn.bonoon.kernel.support.entities.Persistable;

public class EntityPropertyAccessorImpl extends AbstractEntityPropertyAccessor{
	public EntityPropertyAccessorImpl(Class<?> cls, String mappedName,
			Field field, EmbeddedPropertyAccessor embeddedProperty) {
		super(cls, mappedName, field, embeddedProperty);
	}

	@Deprecated
	public EntityPropertyAccessorImpl nested(String name) { 
		return null;
	}
	@Deprecated
	public boolean isTreeEntity(){
		return EntityTree.class.isAssignableFrom(type);
	}

	public boolean isEntity() {
		return Persistable.class.isAssignableFrom(type);
	}

	public boolean isList() {
		return List.class.isAssignableFrom(type);
	}
	
	public boolean isSet(){
		return Set.class.isAssignableFrom(type);
	}

	public boolean isEmbeddable() {
		return Embeddable.class.equals(type);
	}
}
